@echo off
::	MakeCopyOfficeLnk.bat 2024-11-03
::
::	EndCmd

if "%~1"=="" (
	set "EndCmd=k"
) else (
	set "EndCmd=c"
)

if /i exist "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Word.lnk" (
	call :Checkdir %PUBLIC%\desktop\Office365ProPlus\
	copy  /Y  "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Access.lnk"  "%PUBLIC%\desktop\Office365ProPlus\"
	copy  /Y  "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Excel.lnk"  "%PUBLIC%\desktop\Office365ProPlus\"
	copy  /Y  "%ProgramData%\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk"  "%PUBLIC%\desktop\Office365ProPlus\"
	copy  /Y  "%ProgramData%\Microsoft\Windows\Start Menu\Programs\OneNote.lnk"  "%PUBLIC%\desktop\Office365ProPlus\"
	copy  /Y  "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Outlook*.lnk"  "%PUBLIC%\desktop\Office365ProPlus\"
	copy  /Y  "%ProgramData%\Microsoft\Windows\Start Menu\Programs\PowerPoint.lnk"  "%PUBLIC%\desktop\Office365ProPlus\"
	copy  /Y  "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Publisher.lnk"  "%PUBLIC%\desktop\Office365ProPlus\"
	copy  /Y  "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Word.lnk"  "%PUBLIC%\desktop\Office365ProPlus\"
)

goto End

:Checkdir
	rem ====----	https://stackoverflow.com/questions/18639663/how-to-pass-command-line-parameters-with-space-in-batch-file

	if exist "%*" (
		exit /b
	)
	if not exist "%*" (
		mkdir "%*"
	)
	if exist "%*" (
		echo %* Created
	)
	exit /b
	
:End
	%ComSpec% /%EndCmd%